﻿using DAL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public class RoomNumberBLL
    {
        public RoomNumberDAL RoomNumberDAL { get; }

        public RoomNumberBLL(RoomNumberDAL roomNumberDAL)
        {
            RoomNumberDAL = roomNumberDAL;
        }
        /// <summary>
        /// 房号添加
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int RoomNumberAdd(RoomNumberModel info)
        {
            try
            {
                return RoomNumberDAL.RoomNumberAdd(info);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示查询分页
        /// </summary>
        /// <param name="totalCount">页容量</param>
        /// <param name="totalPage">页码</param>
        /// <param name="Pageindex">当前页</param>
        /// <param name="PageSize">页码</param>
        /// <param name="NumberName">房号</param>
        /// <param name="createtime">创建时间</param>
        /// <returns></returns>
        public IQueryable<RoomNumber> GetRoomNumberList(out int totalCount, out int totalPage, int Pageindex = 1, int PageSize = 2, string? NumberName = "", DateTime? createtime = null)
        {
            try
            {
                return RoomNumberDAL.GetRoomNumberList(out totalCount, out totalPage, Pageindex, PageSize, NumberName, createtime);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int RoomNumberDel(int id)
        {
            try
            {
                return RoomNumberDAL.RoomNumberDel(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 批量逻辑删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public int RoomNumberDelAll(string ids)
        {
            try
            {
                return RoomNumberDAL.RoomNumberDelAll(ids);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 批量修改状态
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public int RoomNumberUptAll(string ids, int state)
        {
            try
            {
               return RoomNumberDAL.RoomNumberUptAll(ids, state);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// Id查询(反填)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public RoomNumberModel GetRoomNumberId(int id)
        {
            try
            {
                return RoomNumberDAL.GetRoomNumberId(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int GetRoomNumberNumUpdate(RoomNumberModel info)
        {
            try
            {
              return RoomNumberDAL.GetRoomNumberNumUpdate((RoomNumberModel)info);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
